import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { GoodsInOutInfoVO, GoodsInOutInfoForm, GoodsInOutInfoQuery } from '@/api/erp/goodsInOutInfo/types';

/**
 * 查询进出明细列表
 * @param query
 * @returns {*}
 */

export const listGoodsInOutInfo = (query?: GoodsInOutInfoQuery): AxiosPromise<GoodsInOutInfoVO[]> => {
  return request({
    url: '/erp/goodsInOutInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询进出明细详细
 * @param id
 */
export const getGoodsInOutInfo = (id: string | number): AxiosPromise<GoodsInOutInfoVO> => {
  return request({
    url: '/erp/goodsInOutInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增进出明细
 * @param data
 */
export const addGoodsInOutInfo = (data: GoodsInOutInfoForm) => {
  return request({
    url: '/erp/goodsInOutInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改进出明细
 * @param data
 */
export const updateGoodsInOutInfo = (data: GoodsInOutInfoForm) => {
  return request({
    url: '/erp/goodsInOutInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除进出明细
 * @param id
 */
export const delGoodsInOutInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/erp/goodsInOutInfo/' + id,
    method: 'delete'
  });
};
